package com.example.serviceworkorder.controller;

import com.example.common.util.R;
import com.example.serviceworkorder.pojo.Project;
import com.example.serviceworkorder.service.ProjectService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping(value = "/Service-Project/")
@Tag(name = "项目管理")
public class ProjectController {
    @Autowired
    private ProjectService projectService;

    @Operation(summary = "显示所有项目")
    @GetMapping(value = "/getAllProject")
    public R getAllProject() {
        List<Project> projectList = projectService.list();
        return R.ok().data("projectList", projectList);
    }
}
